package Util;

public class Util {

	public static final long newTuple(int start, int i) {
		return (((long) start) << 32) | (long) i;
	}

	public static final int newPoint(int x, int y) {
		return (x << 16) | (y & 0x0000FFFF);
	}

	public static final int newSize(int width, int height) {
		return newPoint(width, height);
	}

	public static final int getX(int point) {
		return (point >> 16);
	}

	public static final int getY(int point) {
		return (point & 0x0000FFFF);
	}

	public static final int getX(long so) {
		return (int) (so >> 48);
	}

	public static final int getY(long so) {
		return (int) ((so >> 32) & 0x000000000000FFFFL);
	}

	public static final int getWidth(int size) {
		return getX(size);
	}

	public static final int getHeight(int size) {
		return getY(size);
	}

	public static final int getWidth(long so) {
		return (int) ((so >> 16) & 0x000000000000FFFFL);
	}

	public static final int getHeight(long so) {
		return (int) (so & 0x000000000000FFFFL);
	}

	public static Long newStaticObstacle(int x, int y, int width, int height) {
		return newStaticObstacle(newPoint(x, y), newSize(width, height));
	}

	public static Long newStaticObstacle(int point, int size) {
		return newTuple(point, size);
	}
}
